import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../LayoutView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/index',
  },
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children:[
      {
        path: 'index',
        name: 'home',
        component:() => import('../views/HomeView.vue')
      },
      {
        path: 'sort',
        name: 'sort',
        component:() => import('../views/SortView.vue')
      },
      {
        path: 'bookshelf',
        name: 'bookshelf',
        component:() => import('../views/BookshelfView.vue')
      },
      {
        path: 'my',
        name: 'my',
        component:() => import('../views/MyView.vue')
      }
    ]
  },
  {
    path:'/search',
    name:'search',
    component:()=> import("../views/SearchView.vue")
  },
  {
    path:'/detail',
    name:'detail',
    component:()=> import("../views/DetailView.vue")
  },
  {
    path:'/login',
    name:'login',
    component:()=> import("../views/LoginView.vue")
  },
  {
    path:'/register',
    name:'register',
    component:()=> import("../views/RegisterView.vue")
  },
  {
    path:'/rank',
    name:'rank',
    component:()=> import("../bookContent/contentView.vue")
  },
  {
    path:'*',
    name:'error',
    component:()=> import("../views/ErrorView.vue")
  },

]

const router = new VueRouter({
  routes
})

export default router
